package com.lc.entity;

import com.cnpc.framework.utils.DateUtil;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @Description 数据编辑记录
 * @Author  Hunter
 * @Date 2021-12-20
 */

@Setter
@Getter
@ToString
@Entity
@Table ( name ="item_change_record" )
public class ItemChangeRecord implements Serializable {

	private static final long serialVersionUID =  3900448449754079962L;

	@Id
	@GenericGenerator(name = "id", strategy = "uuid")
	@GeneratedValue(generator = "id")
	@Column(name = "id", length = 36)
	private String id;

	/**
	 * 操作人
	 */
	@Column(name = "userid" )
	private String userid;

	@Column(name = "createtime" )
	private String createtime;

	@Column(name = "updatetime" )
	private String updatetime;
	/**
	 * 对象id
	 */
   	@Column(name = "itemid" )
	private String itemid;


	/**
	 * 类别 字典code=item_change_type
	 */
   	@Column(name = "type" )
	private String type;

	/**
	 * 操作前数据
	 */
	@Column(name = "databf" )
	private String databf;


	/**
	 * 操作后数据
	 */
	@Column(name = "dataaf" )
	private String dataaf;


	/**
	 * 备注 预留
	 */
   	@Column(name = "remark" )
	private String remark;

	/**
	 * 0添加 1编辑 2删除
	 */
	@Column(name = "subtype" )
	private Integer subtype;

	/**
	 * 名称
	 */
	@Column(name = "name" )
	private String name;


	public void setDefaultTime(){
		String dateTime = DateUtil.format(new Date(),DateUtil.YYYY_MM_DD_HH_MM_SS);
		createtime = dateTime;
		updatetime = dateTime;
	}

	public void setDefaultCreateTime(){
		String dateTime = DateUtil.format(new Date(),DateUtil.YYYY_MM_DD_HH_MM_SS);
		createtime = dateTime;
	}

	public void setDefaultUpdateTime(){
		String dateTime = DateUtil.format(new Date(),DateUtil.YYYY_MM_DD_HH_MM_SS);
		updatetime = dateTime;
	}


}
